/* data */
import TaskAllotListData from '@src/modules/task/taskTypes/allot/TaskAllotListData'
/* model */
import RootWindowInitData from '@model/interface/initData/RootWindowInitData'
/* util */
import { getRootWindowInitData } from '@src/util/window'
import { isBasicEditionHideSubscribe } from '@shb-lib/version'
import { getRootWindow } from '@src/util/dom'

class TaskAllotListComputed extends TaskAllotListData {
  /**
   * @description 获取顶层窗口初始化数据
   * @return {RootWindowInitData}
   */  
  get rootWindowInitData(): RootWindowInitData {
    return getRootWindowInitData()
  }

  // 基础版功能是否隐藏订阅
  get isBasicEditionHideSubscribe(): boolean {
    return isBasicEditionHideSubscribe() 
  }
  /* 计划开始时间字段 */
  get planStartTimeField() {
    // @ts-ignore
    return this.taskFields?.filter(f => f.fieldName === 'planStartTime')[0];
  }
  /* 计划完成时间字段 */
  get planEndTimeField() {
    // @ts-ignore
    return this.taskFields?.filter(f => f.fieldName === 'planEndTime')[0];
  }
  /*  是否开启服务项目灰度*/
  get isOpenServiceItemsGray(): boolean {
    const RootWindow = getRootWindow(window);
    return Boolean(RootWindow?.grayAuth?.PROJECT_MANAGE);
  }
}

export default TaskAllotListComputed
